﻿<cfsilent>
	<cfscript>
	
		event.setArg("pageTitle", "教学运行基础数据 - 培养方案修订 - 毕业条件设置");

		sql = "SELECT sbj_name, sbj_id 
				FROM t_subject 
				WHERE sbj_id = :SubID ";
		queryObj = new Query( datasource=application.dnsSlave ) ;
   		queryObj.addParam( name="SubID", value=event.getArg("SubID"), cfsqltype="cf_sql_varchar" );
		rs_subject = queryObj.execute( sql=sql ).getResult();
		
		sql = "SELECT credit, credit_required,
					   credit_optional, credit_relish,
					   period, period_required,
					   period_optional 
				FROM t_condition 
				WHERE con_id = :conId ";
		queryObj = new Query( datasource=application.dnsSlave ) ;
   		queryObj.addParam( name="conId", value=event.getArg("Schema"), cfsqltype="cf_sql_varchar" );
		rs_condition = queryObj.execute( sql=sql ).getResult();
		
		sql = "SELECT 
					DISTINCT t_subject.sbj_id, t_subject.sbj_short 
				FROM t_schema 
					 INNER JOIN t_subject ON t_subject.sbj_id = t_schema.sbj_id  
				WHERE 
					t_schema.grade = :grade 
					AND 
					(
						t_subject.sbj_id = :subjectId 
						OR 
						t_subject.sbj_id LIKE :subjectDir 
					) 
					AND 
					SUBSTR(t_schema.shm_prop, 1, 1) = '1' 
				ORDER BY 
					t_subject.sbj_id ";
		queryObj = new Query( datasource=application.dnsSlave ) ;
   		queryObj.addParam( name="grade", value=event.getArg("Edition"), cfsqltype="cf_sql_char" );
		queryObj.addParam( name="subjectId", value=event.getArg("SubID"), cfsqltype="cf_sql_varchar" );
		queryObj.addParam( name="subjectDir", value=event.getArg("SubID") & "_" , cfsqltype="cf_sql_varchar" );
		rs_subjects = queryObj.execute( sql=sql ).getResult();
				
		sql = "SELECT 
					DISTINCT t_subject.sbj_id, t_subject.sbj_short 
				FROM t_schema 
					 INNER JOIN t_subject ON t_subject.sbj_id = t_schema.sbj_id  
				WHERE 
					t_schema.grade = :grade 
					AND 
					(
						t_subject.sbj_id = :subjectId 
						OR 
						t_subject.sbj_id LIKE :subjectDir 
					) 
					AND 
					SUBSTR(t_schema.shm_prop, 2, 1) = '1' 
				ORDER BY 
					t_subject.sbj_id ";
		queryObj = new Query( datasource=application.dnsSlave ) ;
   		queryObj.addParam( name="grade", value=event.getArg("Edition"), cfsqltype="cf_sql_char" );
		queryObj.addParam( name="subjectId", value=event.getArg("SubID"), cfsqltype="cf_sql_varchar" );
		queryObj.addParam( name="subjectDir", value=event.getArg("SubID") & "_" , cfsqltype="cf_sql_varchar" );
		rs_subjectSec = queryObj.execute( sql=sql ).getResult();
		
		sql = "SELECT 
					DISTINCT t_subject.sbj_id, t_subject.sbj_short 
				FROM t_schema 
					 INNER JOIN t_subject ON t_subject.sbj_id = t_schema.sbj_id  
				WHERE 
					t_schema.grade = :grade 
					AND 
					(
						t_subject.sbj_id = :subjectId 
						OR 
						t_subject.sbj_id LIKE :subjectDir 
					) 
					AND 
					SUBSTR(t_schema.shm_prop, 3, 1) = '1' 
				ORDER BY 
					t_subject.sbj_id ";
		queryObj = new Query( datasource=application.dnsSlave ) ;
   		queryObj.addParam( name="grade", value=event.getArg("Edition"), cfsqltype="cf_sql_char" );
		queryObj.addParam( name="subjectId", value=event.getArg("SubID"), cfsqltype="cf_sql_varchar" );
		queryObj.addParam( name="subjectDir", value=event.getArg("SubID") & "_" , cfsqltype="cf_sql_varchar" );
		rs_subjectAst = queryObj.execute( sql=sql ).getResult();
		

		targetArgs = structNew();
		structInsert(targetArgs, "SubID", event.getArg("SubID"), true);
		structInsert(targetArgs, "Edition", event.getArg("Edition"), true);
		structInsert(targetArgs, "Schema", event.getArg("Schema"), true);

		passArgs = structNew();
		structInsert(passArgs, "SubID", event.getArg("SubID"), true);
		structInsert(passArgs, "Edition", event.getArg("Edition"), true);
		structInsert(passArgs, "Schema", event.getArg("Schema"), true);
			
		currentTab = event.getArg("TabID", "labGraduate");
			
	</cfscript>
</cfsilent>

<div id="headArea">
	<div class="uiHeader uiHeaderWithImage ptm">
		<div class="clearfix uiHeaderTop">
			<div class="uiHeaderActions rfloat">
				<a class="uiButton" href="<cfoutput>#buildURL('programSchema')#</cfoutput>"><i class="mrs img btnList"></i><span class="uiButtonText">培养方案</span></a>
			</div>
			<div>
				<h2 class="uiHeaderTitle">
					<i class="uiHeaderImage img icon16x16 edit"></i>培养方案修订 - <cfoutput>#rs_subject.sbj_name#</cfoutput>专业(<cfoutput>#event.getArg("Edition")#</cfoutput>)版
				</h2>
			</div>
		</div>
	</div>
</div>

<!--- 加载导航菜单 --->
<!-- stepMenu-->
<cfoutput>#event.getArg("stepMenu")#</cfoutput>
<!--/stepMenu-->

<div class="UIElement">
	<ul class="senateFirstPage">
		<li>
			<div class="clearfix" id="summary">
				<div class="UItab2">
					<div class="tabLables">
						<span <cfif currentTab eq "labGraduate">class="active"</cfif> id="labGraduate" tabTarget="Graduate">毕业条件</span>
						<span <cfif currentTab eq "labDegreeCourse">class="active"</cfif> id="labDegreeCourse" tabTarget="DegreeCourse">学位课程</span>
						<span <cfif currentTab eq "labSecDegreeCourse">class="active"</cfif> id="labSecDegreeCourse" tabTarget="SecDegreeCourse">双学位课程</span>
						<span <cfif currentTab eq "labAssistCourse">class="active"</cfif> id="labAssistCourse" tabTarget="AssistCourse">辅修课程</span>
					</div>
				</div>
				<script language="javascript" type="text/javascript">
					//<![CDATA[
					<!--
					$(document).ready(function() {
						
						/* init Tab */
						$("div.tabContent").hide();
						$("div#" + $("div.tabLables span.active").attr("tabTarget")).show();
						
						$("div.tabLables > span").click(function(){
							var $targetID = $(this).attr("tabTarget");
							
							$("div.tabLables span").removeClass("active");
							$(this).addClass("active");
							
							$("div.tabContent").not('[id="' + $targetID + '"]').hide();
							$("div.tabContent#" + $targetID).show();
						});
						
					});
					// -->
					//]]>
				</script>
				
				<div id="Graduate" class="tabContent">
				
					<form id="formEdit" onSubmit="javascript:return processVerfiyForm('formEdit');" class="formWrapper" method="post" action="<cfoutput>#buildURL('programSchemaWizardConditionUpdateDo')#</cfoutput>">
						
						<input type="hidden" name="SubjectID" value="<cfoutput>#rs_subject.sbj_id#</cfoutput>" />
						<input type="hidden" name="Grade" value="<cfoutput>#event.getArg('Edition')#</cfoutput>" />
						
						<div class="label">
							<b>毕业总学分</b>
							<input name="Credit" id="Credit" type="text" class="typeSmallInt" verification="double" maxlength="6" value="<cfoutput>#event.getArg('Credit', rs_condition.credit)#</cfoutput>" />
						</div>
						
						<div class="label">
							<b>学分子项要求</b>
							必修课<input name="CreditRequired" id="CreditRequired" type="text" class="typeSmallInt" verification="double" maxlength="6" value="<cfoutput>#event.getArg('CreditRequired', rs_condition.credit_required)#</cfoutput>" />
							选修课<input name="CreditOptional" id="CreditOptional" type="text" class="typeSmallInt" verification="double" maxlength="6" value="<cfoutput>#event.getArg('CreditOptional', rs_condition.credit_optional)#</cfoutput>" />
							素质拓展类<input name="CreditRelish" id="CreditRelish" type="text" class="typeSmallInt" verification="double" maxlength="6" value="<cfoutput>#event.getArg('CreditRelish', rs_condition.credit_relish)#</cfoutput>" />
							<p class="notice">此处的各项学分用于毕业资格审核, 如果对于某一个子项不做要求, 请将学分值设置为0</p>
						</div>
						
						<hr/>
						
						<div class="label">
							<b>毕业总学时</b>
							<input name="Period" id="Period" type="text" class="typeSmallInt" verification="integer" maxlength="8" value="<cfoutput>#event.getArg('Period', rs_condition.period)#</cfoutput>" />
						</div>
						
						<div class="label">
							<b>学时子项要求</b>
							必修课<input name="PeriodRequired" id="PeriodRequired" type="text" class="typeSmallInt" verification="integer" maxlength="8" value="<cfoutput>#event.getArg('PeriodRequired', rs_condition.period_required)#</cfoutput>" />
							选修课<input name="PeriodOptional" id="PeriodOptional" type="text" class="typeSmallInt" verification="integer" maxlength="8" value="<cfoutput>#event.getArg('PeriodOptional', rs_condition.period_optional)#</cfoutput>" />
							<p class="notice">此处的各项学时要求用于毕业资格审核的学时数补充, 如果对于某一个子项不做要求, 请将值设置为0</p>
						</div>
						
						<hr/>
						
						<div class="lable">
							<input class="button" type="submit" value="保存学分要求" />
							<input class="button" type="reset" value="重设表格" />
						</div>
					
					</form>
				
				</div>

				<div id="DegreeCourse" class="tabContent">
					
					<div class="noticeBlock">
						<div class="operation">
							<a class="uiButton " href="<cfoutput>#buildURL('programSchemaWizardCreateDegreeEntity', targetArgs)#</cfoutput>"><i class="mrs img btnAdd"></i><span class="uiButtonText">设置新课程</span></a>
						</div>
						<h3>学位课设置</h3>
						<p><span class="img icon16x16 message"></span>如果您需要设置新的学位课程, 请通过上方的 "设置新课程" 按钮添加专业学位课程.</p>
					</div>
					
					<cfloop query="rs_subjects" >
                    
                    	<cfset sql = "SELECT 
											t_course.course_name, 
											t_course.course_credit, 
											t_institute.institute_short, 
											t_course_prop.prop_name, 
											t_course_nature.cna_name, 
											t_course.period_theory, 
											t_course.period_practice, 
											t_course.period_computer, 
											t_course.course_code, 
											t_subject.sbj_short, 
											t_subject.sbj_id, 
											t_schema.shm_id 
										FROM t_schema 
										   INNER JOIN t_course ON t_course.cid = t_schema.cid 
										   INNER JOIN t_institute ON t_course.institute_id = t_institute.institute_id 
										   INNER JOIN t_course_prop ON t_course_prop.prop_id = t_schema.prop_id 
										   INNER JOIN t_course_nature ON t_course_nature.cna_id = t_schema.cna_id 
										   INNER JOIN t_subject ON t_subject.sbj_id = t_schema.sbj_id  
										WHERE 
											t_schema.grade = :grade 
											AND 
											t_subject.sbj_id = :subjectId 
											AND 
											SUBSTR(t_schema.shm_prop, 1, 1) = '1' 
										ORDER BY 
											t_subject.sbj_id, t_course_nature.cna_name, t_course_prop.prop_name, t_course.course_name  " >
                        <cfset queryObj = new Query( datasource=application.dnsSlave ) />
                        <cfset queryObj.addParam( name="grade", value=event.getArg("Edition"), cfsqltype="cf_sql_char" )/>
                        <cfset queryObj.addParam( name="subjectId", value=rs_subjects.sbj_id, cfsqltype="cf_sql_varchar" )/>
                        <cfset rs_schema = queryObj.execute( sql=sql ).getResult()/> 
											
						<table class="UItable">
							<tr>
								<td align="center" width="22" class="cellBorder"><cfoutput>#rs_subjects.sbj_short#</cfoutput></td>
								<td align="center" class="cellBorder">
									<cfif rs_schema.recordCount>
										<table class="UIEditable">
											<thead>
												<tr>
													<td width="48" align="left">类别</td>
													<td width="60" align="left">课程性质</td>
													<td width="70" align="left">课程号</td>
													<td align="left">课程</td>
													<td width="60" align="left">开课学院</td>
													<td width="24">理论</td>
													<td width="24">实践</td>
													<td width="24">上机</td>
													<td width="40">学分</td>
													<td width="18"></td>
												</tr>
											</thead>
											<tbody>
												<cfloop query="rs_schema" >
													<cfset structInsert( passArgs, "SchemaID", rs_schema.shm_id, true ) />
													<tr class="editRows">
														<td align="left"><cfoutput>#rs_schema.cna_name#</cfoutput></td>
														<td align="left"><cfoutput>#rs_schema.prop_name#</cfoutput></td>
														<td align="left"><span class="numeric"><cfoutput>#rs_schema.course_code#</cfoutput></span></td>
														<td align="left"><cfoutput>#rs_schema.course_name#</cfoutput></td>
														<td align="left"><cfoutput>#rs_schema.institute_short#</cfoutput></td>
														<td><cfif rs_schema.period_theory gt 0><span class="numeric"><cfoutput>#rs_schema.period_theory#</cfoutput></span></cfif></td>
														<td><cfif rs_schema.period_practice gt 0><span class="numeric"><cfoutput>#rs_schema.period_practice#</cfoutput></span></cfif></td>
														<td><cfif rs_schema.period_computer gt 0><span class="numeric"><cfoutput>#rs_schema.period_computer#</cfoutput></span></cfif></td>
														<td><span class="numeric"><cfoutput>#numberFormat(rs_schema.course_credit,'_._')#</cfoutput></span></td>
														<td><a class="stat remove" href="<cfoutput>#buildURL('programSchemaWizardDegreeEntityRemoveDo', passArgs)#</cfoutput>"></a></td>
													</tr>
												</cfloop>
											</tbody>
										</table>
									</cfif>
								</td>
							</tr>
						</table>
					</cfloop>
					
				</div>
				
				
				<div id="SecDegreeCourse" class="tabContent">
					
					<div class="noticeBlock">
						<div class="operation">
							<a class="uiButton " href="<cfoutput>#buildURL('programSchemaWizardCreateSecDegreeEntity', targetArgs)#</cfoutput>"><i class="mrs img btnAdd"></i><span class="uiButtonText">设置新课程</span></a>
						</div>
						<h3>学位课设置</h3>
						<p><span class="img icon16x16 message"></span>如果您需要设置该专业的双学位课程, 请通过上方的 "设置新课程" 按钮添加专业学位课程.</p>
					</div>
					 
                	<cfloop query="rs_subjectSec" >
						 
						<cfset sql = "SELECT 
											t_course.course_name, 
											t_course.course_credit, 
											t_institute.institute_short, 
											t_course_prop.prop_name, 
											t_course_nature.cna_name, 
											t_course.period_theory, 
											t_course.period_practice, 
											t_course.period_computer, 
											t_course.course_code, 
											t_subject.sbj_short, 
											t_subject.sbj_id, 
											a.shm_id 
										FROM t_schema a 
										   INNER JOIN t_course ON t_course.cid = a.cid 
										   INNER JOIN t_institute ON t_course.institute_id = t_institute.institute_id 
										   INNER JOIN t_course_prop ON t_course_prop.prop_id = a.prop_id 
										   INNER JOIN t_course_nature ON t_course_nature.cna_id = a.cna_id 
										   INNER JOIN t_subject ON t_subject.sbj_id = a.sbj_id  
										WHERE 
											a.grade = :grade 
											AND 
											t_subject.sbj_id = :subjectId 
											AND 
											SUBSTR(a.shm_prop,2,1) = '1' 
										ORDER BY 
											t_subject.sbj_id, t_course_nature.cna_name, t_course_prop.prop_name, t_course.course_name  " >
                        <cfset queryObj = new Query( datasource=application.dnsSlave ) />
                        <cfset queryObj.addParam( name="grade", value=event.getArg("Edition"), cfsqltype="cf_sql_char" )/>
                        <cfset queryObj.addParam( name="subjectId", value=rs_subjectSec.sbj_id, cfsqltype="cf_sql_varchar" )/>
                        <cfset rs_schemaSec = queryObj.execute( sql=sql ).getResult()/>  
						<table class="UItable">
							<tr>
								<td align="center" width="22" class="cellBorder"><cfoutput>#rs_subjectSec.sbj_short#</cfoutput></td>
								<td align="center" class="cellBorder">
									<cfif rs_schemaSec.recordCount>
										<table class="UIEditable">
											<thead>
												<tr>
													<td width="48" align="left">类别</td>
													<td width="60" align="left">课程性质</td>
													<td width="70" align="left">课程号</td>
													<td align="left">课程</td>
													<td width="60" align="left">开课学院</td>
													<td width="24">理论</td>
													<td width="24">实践</td>
													<td width="24">上机</td>
													<td width="40">学分</td>
													<td width="18"></td>
												</tr>
											</thead>
											<tbody> 
                                                <cfloop query="rs_schemaSec" >
													<cfset structInsert( passArgs, "SchemaID", rs_schemaSec.shm_id, true ) />
                                        
													<tr class="editRows">
														<td align="left"><cfoutput>#rs_schemaSec.cna_name#</cfoutput></td>
														<td align="left"><cfoutput>#rs_schemaSec.prop_name#</cfoutput></td>
														<td align="left"><span class="numeric"><cfoutput>#rs_schemaSec.course_code#</cfoutput></span></td>
														<td align="left"><cfoutput>#rs_schemaSec.course_name#</cfoutput></td>
														<td align="left"><cfoutput>#rs_schemaSec.institute_short#</cfoutput></td>
														<td><cfif rs_schemaSec.period_theory gt 0><span class="numeric"><cfoutput>#rs_schemaSec.period_theory#</cfoutput></span></cfif></td>
														<td><cfif rs_schemaSec.period_practice gt 0><span class="numeric"><cfoutput>#rs_schemaSec.period_practice#</cfoutput></span></cfif></td>
														<td><cfif rs_schemaSec.period_computer gt 0><span class="numeric"><cfoutput>#rs_schemaSec.period_computer#</cfoutput></span></cfif></td>
														<td><span class="numeric"><cfoutput>#numberFormat(rs_schemaSec.course_credit,'_._')#</cfoutput></span></td>
														<td><a class="stat remove" href="<cfoutput>#buildURL('programSchemaWizardSecDegreeEntityRemoveDo', passArgs)#</cfoutput>"></a></td>
													</tr>
												</cfloop>
											</tbody>
										</table>
									</cfif>
								</td>
							</tr>
						</table>
						
						
					</cfloop>
					
				</div>
				
				<div id="AssistCourse" class="tabContent">
					
					<div class="noticeBlock">
						<div class="operation">
							<a class="uiButton " href="<cfoutput>#buildURL('programSchemaWizardCreateAssistDegreeEntity', targetArgs)#</cfoutput>"><i class="mrs img btnAdd"></i><span class="uiButtonText">设置新课程</span></a>
						</div>
						
						<h3>辅修专业课设置</h3>
						<p><span class="img icon16x16 message"></span>如果您需要设置新的辅修专业课程, 请通过上方的 "设置新课程" 按钮添加专业学位课程.</p>
					</div>
				 
            		<cfloop query="rs_subjectAst" >
					 
						<cfset sql = "SELECT 
											t_course.course_name, 
											t_course.course_credit, 
											t_institute.institute_short, 
											t_course_prop.prop_name, 
											t_course_nature.cna_name, 
											t_course.period_theory, 
											t_course.period_practice, 
											t_course.period_computer, 
											t_course.course_code, 
											t_subject.sbj_short, 
											t_subject.sbj_id, 
											a.shm_id 
										FROM t_schema a 
										   INNER JOIN t_course ON t_course.cid = a.cid 
										   INNER JOIN t_institute ON t_course.institute_id = t_institute.institute_id 
										   INNER JOIN t_course_prop ON t_course_prop.prop_id = a.prop_id 
										   INNER JOIN t_course_nature ON t_course_nature.cna_id = a.cna_id 
										   INNER JOIN t_subject ON t_subject.sbj_id = a.sbj_id  
										WHERE 
											a.grade = :grade 
											AND 
											t_subject.sbj_id = :subjectId 
											AND 
											SUBSTR(a.shm_prop,3,1) = '1' 
										ORDER BY 
											t_subject.sbj_id, t_course_nature.cna_name, t_course_prop.prop_name, t_course.course_name  " >
                        <cfset queryObj = new Query( datasource=application.dnsSlave ) />
                        <cfset queryObj.addParam( name="grade", value=event.getArg("Edition"), cfsqltype="cf_sql_char" )/>
                        <cfset queryObj.addParam( name="subjectId", value=rs_subjectAst.sbj_id, cfsqltype="cf_sql_varchar" )/>
                        <cfset rs_schemaAst = queryObj.execute( sql=sql ).getResult()/>  
						<table class="UItable">
							<tr>
								<td align="center" width="22" class="cellBorder"><cfoutput>#rs_subjectAst.sbj_short#</cfoutput></td>
								<td align="center" class="cellBorder">
									<cfif rs_schemaAst.recordCount>
										<table class="UIEditable">
											<thead>
												<tr>
													<td width="48" align="left">类别</td>
													<td width="60" align="left">课程性质</td>
													<td width="70" align="left">课程号</td>
													<td align="left">课程</td>
													<td width="60" align="left">开课学院</td>
													<td width="24">理论</td>
													<td width="24">实践</td>
													<td width="24">上机</td>
													<td width="40">学分</td>
													<td width="18"></td>
												</tr>
											</thead>
											<tbody> 
                                                <cfloop query="rs_schemaAst" >
													<cfset structInsert( passArgs, "SchemaID", rs_schemaAst.shm_id, true ) />
                                 
													<tr class="editRows">
														<td align="left"><cfoutput>#rs_schemaAst.cna_name#</cfoutput></td>
														<td align="left"><cfoutput>#rs_schemaAst.prop_name#</cfoutput></td>
														<td align="left"><span class="numeric"><cfoutput>#rs_schemaAst.course_code#</cfoutput></span></td>
														<td align="left"><cfoutput>#rs_schemaAst.course_name#</cfoutput></td>
														<td align="left"><cfoutput>#rs_schemaAst.institute_short#</cfoutput></td>
														<td><cfif rs_schemaAst.period_theory gt 0><span class="numeric"><cfoutput>#rs_schemaAst.period_theory#</cfoutput></span></cfif></td>
														<td><cfif rs_schemaAst.period_practice gt 0><span class="numeric"><cfoutput>#rs_schemaAst.period_practice#</cfoutput></span></cfif></td>
														<td><cfif rs_schemaAst.period_computer gt 0><span class="numeric"><cfoutput>#rs_schemaAst.period_computer#</cfoutput></span></cfif></td>
														<td><span class="numeric"><cfoutput>#numberFormat(rs_schemaAst.course_credit,'_._')#</cfoutput></span></td>
														<td><a class="stat remove" href="<cfoutput>#buildURL('programSchemaWizardAssistDegreeEntityRemoveDo', passArgs)#</cfoutput>"></a></td>
													</tr>
												</cfloop>
											</tbody>
										</table>
									</cfif>
								</td>
							</tr>
						</table>
					</cfloop>
					
				</div>
				
				

			</div>
		</li>
	</ul>
</div>